/**
* File Name: pthrd_join1.c
* Auther: Jichang
* Environment: Fedora 7 server
* simple pthread.
*/
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#include<pthread.h>

void sys_err(const char *str)
{
	perror(str);
	exit(1);
}

void *tfn(void *arg)
{
	return (void*)74;
}

int main(int argc, char *argv[])
{
	pthread_t tid;
	int retval;
	// create
	int ret = pthread_create(&tid, NULL, tfn, NULL);
	if(ret != 0) {
		sys_err("pthread_create error");
	}
	ret = pthread_join(tid, (void **)&retval);
	if(ret != 0) {
		sys_err("pthread_join error");
	}
	printf("retvalue: %d\n", retval);
	pthread_exit(NULL);
	
	return 0;
}

